//
//  PromptView.m
//  firstpoint
//
//  Created by 泽中 on 2017/7/10.
//  Copyright © 2017年 xzcysoft. All rights reserved.
//

#import "PromptView.h"
#import "AppDelegate.h"
@implementation PromptView
+(void)showView:(NSString*)str style:(int)style
{
    UIWindow*window=[UIApplication sharedApplication].keyWindow;
    UIView*view=[[UIView alloc]initWithFrame:window.bounds];
    [window addSubview:view];
    UIView*garyView=[[UIView alloc]initWithFrame:CGRectMake(width_screen/3.0/2.0, height_screen/2-42.5, width_screen/3.0*2, 85)];
    garyView.backgroundColor=[UIColor redColor];
    garyView.alpha=.6;
    garyView.layer.cornerRadius=5;
    [view addSubview:garyView];
    //img
    UIImageView*img=[[UIImageView alloc]initWithFrame:CGRectMake(width_screen/2-15,  height_screen/2-30, 30, 30 )];
    img.image=[UIImage imageNamed:@"xianghaoyoutuijian"];
    [view addSubview:img];
    //lab
    UILabel*lab=[[UILabel alloc]initWithFrame:CGRectMake(width_screen/3.0/2.0, height_screen/2, width_screen/3.0*2, 42.5)];
    lab.text=str;
    lab.textAlignment=NSTextAlignmentCenter;
    lab.textColor=[UIColor whiteColor];
    [view addSubview:lab];
    dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7/*延迟执行时间*/ * NSEC_PER_SEC));
    
    dispatch_after(delayTime, dispatch_get_main_queue(), ^{
        [view removeFromSuperview];
    });
}
@end
